package String;

import java.util.Scanner;

/**
 * String substring(String s,String a)
 * 获取指定范围的字符串，包左不包右*/
public class SubstringDemo {
    public static void main(String[] args) {
        String str = "www.baidu.com.cn";
        int start = str.indexOf(".")+1;
        int end = str.indexOf(".",start);
        String name = str.substring(start,end);//截取下标4到9的字符串
        System.out.println(name);
        sub();
    }
    public static void sub(){
        Scanner scanner = new Scanner(System.in);
        String str = "www.baidu.com";
        System.out.println(str);
        int start = scanner.nextInt();
        int end = scanner.nextInt();
        System.out.println(str.substring(start,end));

    }
}
